<?php
/**
 * Smart Library - Smart Framework
 * http://smart-framework.highet.eu
 *
 * @category   SmartL
 * @package    SmartL_Debug
 * @copyright  Copyright (c) 2005-2008 Smart Framework team - Stepan Sindelar, Vojtech Vit
 * @license    http://www.opensource.org/licenses/bsd-license.php	New BSD License
 */

/**
 * Wrapper for class Nette::Debug. This class is smart debugging tool from Nette framework.
 * If Nette framework is not aviable, standard php functions are called.
 *
 * @package SmartL_Debug
 */
class SmartL_Debug {
	/**
	 * If path Nette framework is in include paths and file Nette/Debug.php is aviable,
	 * Nette debugger is enabled.
	 *
	 */
	public static function enable() {
		if (Zend_Loader::isReadable ( 'Nette/Debug.php' )) {
			include_once 'Nette/Debug.php';
			Debug::enable ();
		}
	}
	
	/**
	 * Prints out the varibale.
	 * If Nette debuggin feature is avible the dump is done via it,
	 * if not standard function dump is called.
	 *
	 * @param unknown_type $variable
	 * @param unknown_type $die
	 */
	public static function dump($variable, $die = false, $echo = true) {
		if (class_exists ( 'Debug' )) {
			return Debug::dump ( $variable, ! $echo );
		} else {
			return Zend_Debug::dump ( $variable, '', $echo );
		}
		
		if ($die)
			die ();
	}
}